// import Cookies from 'js-cookie'

const TokenKey = 'Ningdong-Token'
const userInfoKey = 'Ningdong-UserInfo'
/**
 * cookie 存储
 * @returns
 */
export function getToken() {
  return localStorage.getItem(TokenKey)
  // return Cookies.get(TokenKey)
}

export function setToken(token) {
  return localStorage.setItem(TokenKey, token)
  // return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
  // return Cookies.remove(TokenKey)
}
/**
 * 个人信息存储
 * @returns
 */

export function getUserInfo() {
  let data = localStorage.getItem(userInfoKey) || `{}`
  return JSON.parse(data)
}

export function setUserInfo(data) {
  let json = JSON.stringify(data)
  return localStorage.setItem(userInfoKey, json)
}

export function removeUserInfo() {
  return localStorage.removeItem(userInfoKey)
}

